package com.tm.readwritedemo.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.tm.readwritedemo.entity.StuEntity;
import com.tm.readwritedemo.mapper.StuMapper;
import com.tm.readwritedemo.service.StuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StuServiceImpl implements StuService {

    @Autowired
    private StuMapper stuMapper;

    @Override
    @DS("master")
    public StuEntity test(){
        StuEntity stuEntity = stuMapper.selectById(1);
        return stuEntity;
    }

    @Override
    @DS("slave_1")
    public StuEntity test1(){
        StuEntity stuEntity = stuMapper.selectById(1);
        return stuEntity;
    }
}
